const epxress = require('express')
const path = require('path')
const cors = require('cors')

var config = require('./config/default')


const app = epxress()

// 获取静态路径
app.use(epxress.static(path.join(__dirname, '/dist')))
app.use(epxress.static(path.join(__dirname, '/data')))

// 跨域 
app.use(cors())

// 解析数据
app.use(epxress.json())
app.use(epxress.urlencoded({ extended: false }))


// 引入路由
require('./routes/index')(app)
// require('./routes/files')(app)

app.listen(config.port, () => {
  console.log('server is running at http://localhost:'+config.port)
})


